'''
$LastChangedBy: csgillespie $
$LastChangedDate: 2007-06-06 11:08:06 +0000 (Wed, 06 Jun 2007) $
Some basic unittesting
'''
import unittest
import os, sys
DIR = '/data/ncsg3/svn/pythonR/BasisTools/trunk/'
sys.path.insert(0, DIR)
from pysbml import pysbml
class TestSBML2(unittest.TestCase):
	'''Tests the sbml2html and sbml2mod function'''
	
	def setUp(self):
		'''Make a list of the SBML files available'''
		test_dir = DIR + '/test/'
		self.sbml_files = []
		for file in os.listdir(test_dir):
			if file[-4:] == '.xml':
				self.sbml_files.append(test_dir + file)
		
	
	def testSBML2HTML(self):
		for file in self.sbml_files:
			pysbml(sbml_file = file, path=DIR).sbml2html()
	
	def testSBML2Mod(self):
		for file in self.sbml_files:
			sbml1 = pysbml(sbml_file = file).sbmlModel()
			mod = pysbml(sbml_file = file).sbml2mod()
			sbml2 = pysbml(mod=mod).sbmlModel()
			self.assertEqual(sbml1.m.getNumSpecies(), sbml2.m.getNumSpecies())
			self.assertEqual(sbml1.m.getNumReactions(), sbml2.m.getNumReactions())
			self.assertEqual(sbml1.m.getNumEvents(), sbml2.m.getNumEvents())
			self.assertEqual(sbml1.m.getNumCompartments(), \
										sbml2.m.getNumCompartments())
			self.assertEqual(sbml1.m.getNumParameters(), \
										sbml2.m.getNumParameters())
		
		
if __name__ == '__main__':
    unittest.main()
